package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.Employee;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmployeeMapper {

    /*
    * 根据用户名查找用户
    * */
    @Select("select * from employee where username =#{username}")
    Employee login(Employee employee);


    /*
    * 添加用户
    * */
    @Insert("insert into employee values (null,#{name},#{username},#{password},#{phone},#{sex},#{idNumber}," +
            "#{status},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    Integer save(Employee employee);


    /*
    * 根据员工姓名查询员工列表
    * */
    List<Employee> findByName(@Param("name") String name);


    /*
    * 修改员工禁用启用
    * */
    Integer update(Employee employee);


    /*
    * 编辑员工信息
    * */
    @Select("select *from employee where id=#{id}")
    Employee findById(Long id);
}
